const {
    log
} = require('debug');
var express = require('express');
var router = express.Router();

const {
    getClaims,
    addClaims,
    deleteClaims,
    getClaimsById,
    updateClaims
} = require('../service/ClaimsService');

//获取保险数据
router.get('/getClaims', async function (req, res, next) {
    console.log(111, req.query);
    const data = await getClaims(req.query)
    res.send({
        status: 1,
        message: '获取保险数据成功',
        data
    });
});

// 新增保险
router.post('/addClaims', async function (req, res, next) {
    res.send(await addClaims(req.body));
});

// 根据 _id 删除保险
router.post('/deleteClaims', async function (req, res, next) {
    res.send(await deleteClaims(req.body));
});

// 根据 _id 获取一个保险信息
router.post('/getClaimsById', async function (req, res, next) {
    res.send(await getClaimsById(req.body));
});

// 修改保险
router.post('/updateClaims', async function (req, res, next) {
    res.send(await updateClaims(req.body))
});


module.exports = router;